﻿using System.Collections.Generic;

namespace Multiprocessing.Core.Mathematics.Matrices
{
    public class RowCollection : PartCollection<MatrixRow>
    {
        #region Constructors

        public RowCollection(IMatrix parent) 
            : base(parent)
        {
        }

        #endregion

        #region Methods

        protected override MatrixRow GetItem(int index)
        {
            return new MatrixRow(this.Parent, index);
        }

        public override IEnumerator<MatrixRow> GetEnumerator()
        {
            for (int i = 0; i < this.Parent.RowCount; ++i)
            {
                yield return this.GetItem(i);
            }
        }

        #endregion
    }
}
